'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable('system_permissions', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      parent_id: {
        type: Sequelize.INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: '父级id'
      },
      name: {
        type: Sequelize.STRING(125),
        allowNull: false,
        defaultValue: '',
        comment: '权限标识'
      },
      display_name: {
        type: Sequelize.STRING(125),
        allowNull: false,
        defaultValue: '',
        comment: '显示权限名称'
      },
      effect_uri: {
        type: Sequelize.STRING(125),
        allowNull: false,
        defaultValue: '',
        comment: '管理的路由'
      },
      description: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: '',
        comment: '权限简介'
      },
      sort: {
        type: Sequelize.TINYINT,
        allowNull: false,
        defaultValue: 0,
        comment: '排序'
      },
      created_at: {
        allowNull: false,
        type: Sequelize.DATE
      },
      updated_at: {
        allowNull: false,
        type: Sequelize.DATE
      }
    });
  },
  async down(queryInterface, Sequelize) {
    await queryInterface.dropTable('system_permissions');
  }
};